package cn.y.operation.application.web.controller;

import cn.y.operation.application.web.entity.AttendRecord;
import cn.y.operation.application.web.service.AttendRecordService;
import cn.y.operation.framework.page.TableDataInfo;
import cn.y.operation.framework.mvc.BaseController;
import cn.y.operation.framework.mvc.ResponseMsg;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

/**
 * @ClassName: AttendRecordController
 * @author: 叶子豪
 * @create: 2021-04-15 14:10
 */
@Controller
@RequestMapping("/attend")
public class AttendRecordController extends BaseController {
    @Resource
    private AttendRecordService attendRecordService;

    @PostMapping("/getAttendRecordById")
    @ResponseBody
    public ResponseMsg getAttendRecordById(@RequestParam int id) {
        AttendRecord attendRecord = attendRecordService.getAttendRecordByID(id);
        return data(attendRecord);
    }

    @RequestMapping("/getAttendRecordList")
    @ResponseBody
    public TableDataInfo getAttendRecordList(AttendRecord attendRecord) {
        startPage();
        List<AttendRecord> attendRecordList = attendRecordService.getAttendRecordList(attendRecord);
        return getDataTable(attendRecordList);
    }
}
